<script type="text/javascript">
function showHideDetail(){
	var title = $("#detailTitle").html();
	if (title == "[+] Show Detail Errors"){
		$("#detailTitle").html("[-] Hide Detail Errors");
		$("#detailError").css("display","inline");
	}else{
		$("#detailTitle").html("[+] Show Detail Errors");
		$("#detailError").css("display","none");
	}		
}
</script>
<style>
	#detailTitle{
		cursor:pointer;
	}
</style>
<div>
	<h1>Applicatin Errors</h1>
	<hr>
	<div style="color:red;">
	<?php
	
	if (is_array($messages)){
		$i=1;
		foreach ($messages as $message){
			echo "$i. $message </br>";
			$i++;
		}
	}else{
		echo "1. $messages </br>"; 
	}
	?>
	</div>
	<hr style="margin-top:20px">
	<div id="detailTitle" onClick="showHideDetail()">[+] Show Detail Errors</div>
	<hr>
	<div id="detailError" style="display:none">
		<div>
			<?php print_r($errors);	?>
		</div>
		<div>
			<?php		
				$debugOn = true;
				if ($debugOn){
					$exc = $exception;
					echo "<div>" . $exc->getMessage() ." - ". $exc->getFile() .":". $exc->getLine() ."</div>";
					$arrTrace = $exc->getTrace();
					foreach ($arrTrace as $trace){
						echo "<div>";
						echo $trace["file"] .":". $trace["line"] ." - ".$trace["function"];
						echo "</div>";
					} 
				}
			?> 
		</div>			
	</div>
</div>